package ru.gosoplata.view 
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import ru.gosoplata.model.TmpModel;
	import ru.gosoplata.events.NextEvent;
	import uicontrols.ButtonBase;
	/**
	 * ...
	 * @author 
	 */
	public class CoinOutMediator extends EventDispatcher implements IMediator
	{
		[Event(name = "next", type = "ru.gosoplata.events.NextEvent")]
		
		private var _view:ICoinOut;
		
		public function CoinOutMediator(view:ICoinOut) 
		{
			_view = view;
			
			TmpModel.acceptor.addEventListener("DispenceEnd", onDispenceEnd);
			_view.addEventListener(NextEvent.NEXT, onNext);
		}
		
		/* INTERFACE ru.gosoplata.view.IMediator */
		
		public function reDraw():void 
		{
			_view.nextBtnVisible = false;
			_view.infoText = "ВЫДАЧА СДАЧИ МОНЕТАМИ \n Дождитесь окончания выдачи монет.";
		}
		
		private function onNext(e:Event):void 
		{
			TmpModel.tmpGlobalController.controllerFinishPay();
		}
		
		private function onDispenceEnd(e:Event):void 
		{
			_view.nextBtnVisible = true;
			_view.infoText = 'Возьмите сдачу и нажмите кнопку "Далее"';
		}
	}
}